/**************************
* @Summary
* @Author 20009200303 赵传博
* @Date 6/16/2022
* @Note
*****************************/

#include "Queue.h"
#include <iostream>
using std::cout;
using std::endl;

void Queue::push(int elem) {
    if(queue.size() < MAX_SIZE){
        queue.push_back(elem);
    }else{
        cout << "The queue is full!" << endl;
    }
}

int Queue::pop() {
    if(queue.empty()){
        cout << "The queue is empty!" << endl;
        return -1;
    }else{
        auto begin = queue.begin();
        int ret = *begin;
        queue.erase(begin);
        return ret;
    }
}

int Queue::operator--() {
    return pop();
}

ostream &operator<<(ostream &os, Queue &q) {
    for(auto num : q.queue){
        cout << num << " ";
    }
    cout << endl;
    return os;
}

Queue operator+(Queue q, int num){
    Queue qq = q;
    qq.push(num);
    return qq;
}

Queue operator+(int num, Queue q){
    Queue qq = q;
    qq.push(num);
    return qq;
}